import { execSync } from 'node:child_process'
import { consola } from 'consola'
import { version } from '../package.json'

execSync('npm run build:all', { stdio: 'inherit' })

const command = 'cd packages/mobile && TIMESTAMP=$(date +%Y%m%d%H%M%S) && VERSION=$(jq -r .version package.json) && NEW_VERSION="${VERSION}-${TIMESTAMP}" && npm version $NEW_VERSION --no-git-tag-version && npm publish && npm version $VERSION '

execSync(command, { stdio: 'inherit' })

consola.success(`Published npm package version ${version}`)
